<?php

include_once("../../config.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'repair'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
?>
  



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/modules/head.php'); ?>
</head>

<body>
 



 
<?php





//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
$nowpageid      = addslashes($_REQUEST['nowpageid']);
$sortby         = addslashes($_REQUEST['sortby']);
$term_nid       = addslashes($_REQUEST['term_nid']);

//设置需要搜索的表格的前缀后缀
$table_Suffix = $plate['table_Suffix'];
$table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


 $sql=insert_date($table,$_REQUEST);


//先检查一下车辆的状态，如果是已经借出或者维修，否则就不要出去了。
$equipment=select_one_line_all_items($table_Prefix."equipment","nid = '".$_REQUEST['ai_equipmentid']."'");
$equipment_department=$equipment['departmentid'];




if($equipment['status']!="正常")
{
?>
<script type="text/javascript">
    alert("设备状态异常，请检查再借出.");
  document.location.href = "../equipment/detail-list.php?nav-itemed=equipment";
</script>

<?

}

else {


    $query = mysql_query($sql) or die ($sql);


//更新设备表的状态
//设置需要搜索的表格的前缀后缀
    $table_Suffix = "equipment";
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


 $sql2 = "update $table SET
status= '".$_REQUEST['ai_status']."' where nid= '".$_REQUEST['ai_equipmentid']."'";


    $query = mysql_query($sql2) or die ('修改设备状态失败！');


    mysql_close($con);



?>
<script type="text/javascript">
    alert("输入信息已保存，点击确认返回继续操作.");
   document.location.href = "../equipment/detail-statistic.php?nav-itemed=equipment&nid=<? echo $_REQUEST['ai_equipmentid'] ?>"
</script>

<?

}
?>






</body>